<%@ page import="com.google.common.collect.Lists" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ page import="java.util.Date" %>
<%@ page import="java.util.List" %><%--
  用于查看系统信息
--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    Runtime runtime = Runtime.getRuntime();
    long freeMemory = runtime.freeMemory();
    long totalMemory = runtime.totalMemory();
    long maxMemory = runtime.maxMemory();

    List<String> infos = Lists.newArrayList();
    infos.add(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
    infos.add("JVM  INFO:");
    infos.add("Max  Memory:" + maxMemory / 1024 / 1024 + "  M");
    infos.add("Total Memory:" + totalMemory / 1024 / 1024 + "  M");
    infos.add("Used Memory:" + (totalMemory - freeMemory) / 1024 / 1024 + "  M");
    infos.add("Free Memory:" + freeMemory / 1024 / 1024 + "  M");
    response.getWriter().write(String.join("<br>", infos));
%>
